package ru.eas.search;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author aesipov
 */
public class BinarySearch {

    //        int[] array = {1, 5, 8, 12, 13};
//        int[] keys = {8, 1, 23, 1, 11};

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = scanner.nextInt();
        }

        int k = scanner.nextInt();
        int[] keys = new int[k];
        for (int i = 0; i < keys.length; i++) {
            keys[i] = scanner.nextInt();
        }

        int[] result = new int[keys.length];
        for (int i = 0; i < keys.length; i++) {
            result[i] = search(array, keys[i], 0, array.length - 1);
        }

        for (int i = 0; i < result.length; i++) {
            if (result[i] != -1) {
                result[i]++;
            }
        }

        System.out.println(Arrays.toString(result).replace("[", "").replace("]", "").replace(",", ""));
    }

    static int search(int[] array, int key, int left, int right) {
        while (left <= right) {
            int middle = (right + left) / 2;
            if (array[middle] == key) {
                return middle;
            } else {
                if (key < array[middle]) {
                    right = middle - 1;
                } else {
                    left = middle + 1;
                }
            }
        }
        return -1;
    }
}
